Component({
  /**
   * 组件的属性列表
   */
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    actions: {
      type: Array,
      value: []
    },
    title: {
      type: String,
      value: ''
    },
    maskClosable: {
      type: Boolean,
      value: true
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleItemClick(e) {
      const { index } = e.currentTarget.dataset;
      const item = this.data.actions[index];
      
      this.triggerEvent('select', item);
    },
    
    handleMaskClick() {
      if (this.data.maskClosable) {
        this.triggerEvent('close');
      }
    },
    
    handleCancel() {
      this.triggerEvent('close');
    },
    
    // 阻止事件冒泡
    catchTap() {
      return false;
    }
  }
}) 